package com.hdax.dm.rest.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hdax.dm.dao.item.DmCinemaSeatMapper;
import com.hdax.dm.entity.item.DmCinemaSeat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(path = "/item")
@Api(value = "排期座位接口",tags = "排期座位接口")
public class DmCinemaSeatRestService {

    @Autowired
    private DmCinemaSeatMapper seatMapper;

    @PostMapping(path = "/seat/getSeatList")
    @ApiOperation(value = "根据排期id查询座位列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "scheduleId", required = true, type = "long")
    })
    public List<DmCinemaSeat> getSeatList(@RequestParam("scheduleId")Long scheduleId){
        QueryWrapper<DmCinemaSeat> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("scheduleId",scheduleId);
        return seatMapper.selectList(queryWrapper);
    }
}
